package com.ruoyi.project.controller;

import java.util.List;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.project.domain.A06PubBanner;
import com.ruoyi.project.service.IA06PubBannerService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 轮播图Controller
 * 
 * @author WorrilessGo
 * @date 2025-11-18
 */
@RestController
@RequestMapping("/banner")
public class A06PubBannerController extends BaseController
{
    @Resource
    private IA06PubBannerService a06PubBannerService;

    /**
     * 查询轮播图列表
     */
    @GetMapping("/list")
    public TableDataInfo list(A06PubBanner a06PubBanner)
    {
        startPage();
        List<A06PubBanner> list = a06PubBannerService.selectA06PubBannerList(a06PubBanner);
        return getDataTable(list);
    }

    /**
     * 导出轮播图列表
     */
    @Log(title = "轮播图", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, A06PubBanner a06PubBanner)
    {
        List<A06PubBanner> list = a06PubBannerService.selectA06PubBannerList(a06PubBanner);
        ExcelUtil<A06PubBanner> util = new ExcelUtil<A06PubBanner>(A06PubBanner.class);
        util.exportExcel(response, list, "轮播图数据");
    }

    /**
     * 获取轮播图详细信息
     */
    @GetMapping(value = "/{pubBannerId}")
    public AjaxResult getInfo(@PathVariable("pubBannerId") String pubBannerId)
    {
        return success(a06PubBannerService.selectA06PubBannerByPubBannerId(pubBannerId));
    }

    /**
     * 新增轮播图
     */
    @Log(title = "轮播图", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody A06PubBanner a06PubBanner)
    {
        return toAjax(a06PubBannerService.insertA06PubBanner(a06PubBanner));
    }

    /**
     * 修改轮播图
     */
    @Log(title = "轮播图", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody A06PubBanner a06PubBanner)
    {
        return toAjax(a06PubBannerService.updateA06PubBanner(a06PubBanner));
    }

    /**
     * 删除轮播图
     */
    @Log(title = "轮播图", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pubBannerIds}")
    public AjaxResult remove(@PathVariable String[] pubBannerIds)
    {
        return toAjax(a06PubBannerService.deleteA06PubBannerByPubBannerIds(pubBannerIds));
    }
}
